package com.experienceBaby.Cashbook.view;

import android.content.Context;
import android.util.Log;
import android.widget.TextView;

import com.experienceBaby.Cashbook.R;
import com.github.mikephil.charting.components.MarkerView;
import com.github.mikephil.charting.data.Entry;
import com.github.mikephil.charting.highlight.Highlight;
import com.github.mikephil.charting.utils.MPPointF;

public class MyMarkerView extends MarkerView {
    TextView tv_mv;


    /**
     * Constructor. Sets up the MarkerView with a custom layout resource.
     *
     * @param context
     * @param layoutResource the layout resource to use for the MarkerView
     */
    public MyMarkerView(Context context, int layoutResource) {
        super(context, layoutResource);
        tv_mv = findViewById(R.id.tv_mv);
    }

    @Override
    public void refreshContent(Entry e, Highlight highlight) {
        super.refreshContent(e, highlight);
        Log.i("refreshContent", String.format("%.0f", e.getX()) + "号消费：" + e.getY() + "元");
        String s = String.format("%.0f", e.getX()) + "号消费：" + String.format("%.2f", e.getY()) + "元";
        tv_mv.setText(s);
    }

}
